
#include "stdafx.h"
#include "DefectCmd.h"
#include "DT56Dlg.h"
#include "LeftDlg.h"
CDefectCmd::CDefectCmd()
{
}


CDefectCmd::~CDefectCmd()
{
}

CDefectCmd::CDefectCmd(int nPile, int nHam, WAVE_OPERATE Operate, bool bSetDefect)
{
	m_nPile = nPile;
	m_nHam = nHam;
	m_Operate = Operate;
	m_bSetDefect = bSetDefect;
	CDT56Dlg::m_pDTWnd->SetMenuUndo(TRUE);
}

void CDefectCmd::Redo()
{
	CDTData::GetInstance()->SetUndoDefect(m_nPile, m_nHam, m_Operate, m_bSetDefect);
	if (CDTData::GetInstance()->m_nSelPileNo == m_nPile &&
		CDTData::GetInstance()->m_nSelHamNo == m_nHam)
	{
		CLeftDlg::m_pLeftWnd->m_BasicInfoDlg->UpdateDescribe();
		CDT56Dlg::m_pDTWnd->SetMenuDefectRedoGray();
	}
}

void CDefectCmd::Undo()
{
	CDTData::GetInstance()->SetUndoDefect(m_nPile, m_nHam, m_Operate, !m_bSetDefect);
	if (CDTData::GetInstance()->m_nSelPileNo == m_nPile &&
		CDTData::GetInstance()->m_nSelHamNo == m_nHam)
	{
		CLeftDlg::m_pLeftWnd->m_BasicInfoDlg->UpdateDescribe();
		CDT56Dlg::m_pDTWnd->SetMenuDefectRedoGray();
	}
}